#include "ProducerThread.hpp"
#include "ConsumerThread.hpp"
#include "TaskQueue.hpp"

#include <iostream>
#include <memory>

using std::cout;
using std::endl;
using std::unique_ptr;

int main()
{
    // 创建了一个任务队列（流水线）
    wd::TaskQueue taskque(10);
    // 创建一个生产者和一个消费者
    unique_ptr<wd::Thread> producer(new ProducerThread(taskque));
    unique_ptr<wd::Thread> consumer(new ConsumerThread(taskque));
    producer -> start();
    consumer -> start();

    producer -> join();
    consumer -> join();

    cout << endl << "main thread is exiting ^_^ " << endl << endl;

    return 0;
}
